<?php 
class CMS_Models_Order extends Zend_Db_Table_Abstract
{
  protected $_name = "order";	
	
  public function __construct( )
  {
    parent::__construct(array('table' =>$this->_name));
  }
  
  public function getProductsByOrder($id)
  {
     $sql = "select * from product_order o
      		  where o.id_order = '$id'";
      return TN_Db::getInstance()->fetchAll($sql);
  }
  
  public function getOrderByStatus($s)
  {
    return $this->fetchAll(array("status = '$s'"));
  }
  
  public function getOrderById($id)
  {
    return $this->fetchRow("id = '$id' ");
  }
   
  public function getEnabledOrderByCategory($c)
  {
	return $this->fetchAll(array("id_category = '$c'", "enabled = 1"),"title");
  }
  
  public function getAll()
  {
    return $this->fetchAll();
  }
}
?>